/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "MUSICGROUPMEMBER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Musicgroupmember.findAll", query = "SELECT m FROM Musicgroupmember m"),
    @NamedQuery(name = "Musicgroupmember.findByMusicGroupMemberId", query = "SELECT m FROM Musicgroupmember m WHERE m.musicGroupMemberId = :musicGroupMemberId"),
    @NamedQuery(name = "Musicgroupmember.findByCreatedBy", query = "SELECT m FROM Musicgroupmember m WHERE m.createdBy = :createdBy"),
    @NamedQuery(name = "Musicgroupmember.findByCreatedDate", query = "SELECT m FROM Musicgroupmember m WHERE m.createdDate = :createdDate"),
    @NamedQuery(name = "Musicgroupmember.findByModifiedBy", query = "SELECT m FROM Musicgroupmember m WHERE m.modifiedBy = :modifiedBy"),
    @NamedQuery(name = "Musicgroupmember.findByModifiedDate", query = "SELECT m FROM Musicgroupmember m WHERE m.modifiedDate = :modifiedDate")})
public class Musicgroupmember implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "MUSIC_GROUP_MEMBER_ID")
    private Long musicGroupMemberId;
    @Basic(optional = false)
    @Column(name = "CREATED_BY")
    private String createdBy;
    @Basic(optional = false)
    @Column(name = "CREATED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdDate;
    @Column(name = "MODIFIED_BY")
    private String modifiedBy;
    @Column(name = "MODIFIED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date modifiedDate;
    @JoinColumn(name = "MUSIC_GROUP_ID", referencedColumnName = "MUSIC_GROUP_ID")
    @ManyToOne(optional = false)
    private Musicgroup musicGroupId;
    @JoinColumn(name = "ARTIST_ID", referencedColumnName = "ARTIST_ID")
    @ManyToOne(optional = false)
    private Artist artistId;

    public Musicgroupmember() {
    }

    public Musicgroupmember(Long musicGroupMemberId) {
        this.musicGroupMemberId = musicGroupMemberId;
    }

    public Musicgroupmember(Long musicGroupMemberId, String createdBy, Date createdDate) {
        this.musicGroupMemberId = musicGroupMemberId;
        this.createdBy = createdBy;
        this.createdDate = createdDate;
    }

    public Long getMusicGroupMemberId() {
        return musicGroupMemberId;
    }

    public void setMusicGroupMemberId(Long musicGroupMemberId) {
        Long oldMusicGroupMemberId = this.musicGroupMemberId;
        this.musicGroupMemberId = musicGroupMemberId;
        changeSupport.firePropertyChange("musicGroupMemberId", oldMusicGroupMemberId, musicGroupMemberId);
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        String oldCreatedBy = this.createdBy;
        this.createdBy = createdBy;
        changeSupport.firePropertyChange("createdBy", oldCreatedBy, createdBy);
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        Date oldCreatedDate = this.createdDate;
        this.createdDate = createdDate;
        changeSupport.firePropertyChange("createdDate", oldCreatedDate, createdDate);
    }

    public String getModifiedBy() {
        return modifiedBy;
    }

    public void setModifiedBy(String modifiedBy) {
        String oldModifiedBy = this.modifiedBy;
        this.modifiedBy = modifiedBy;
        changeSupport.firePropertyChange("modifiedBy", oldModifiedBy, modifiedBy);
    }

    public Date getModifiedDate() {
        return modifiedDate;
    }

    public void setModifiedDate(Date modifiedDate) {
        Date oldModifiedDate = this.modifiedDate;
        this.modifiedDate = modifiedDate;
        changeSupport.firePropertyChange("modifiedDate", oldModifiedDate, modifiedDate);
    }

    public Musicgroup getMusicGroupId() {
        return musicGroupId;
    }

    public void setMusicGroupId(Musicgroup musicGroupId) {
        Musicgroup oldMusicGroupId = this.musicGroupId;
        this.musicGroupId = musicGroupId;
        changeSupport.firePropertyChange("musicGroupId", oldMusicGroupId, musicGroupId);
    }

    public Artist getArtistId() {
        return artistId;
    }

    public void setArtistId(Artist artistId) {
        Artist oldArtistId = this.artistId;
        this.artistId = artistId;
        changeSupport.firePropertyChange("artistId", oldArtistId, artistId);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (musicGroupMemberId != null ? musicGroupMemberId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Musicgroupmember)) {
            return false;
        }
        Musicgroupmember other = (Musicgroupmember) object;
        if ((this.musicGroupMemberId == null && other.musicGroupMemberId != null) || (this.musicGroupMemberId != null && !this.musicGroupMemberId.equals(other.musicGroupMemberId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.Musicgroupmember[ musicGroupMemberId=" + musicGroupMemberId + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
